<template>
  <qc-page-table
    ref="loginLogPageTableRef"
    :columns="columns"
    :loadData="loadData"
    :rowKey="(record) => record[primaryKey]"
    :tableSelection="null"
  >
    <template #toolbarTitle>
      {{ t('org.login-log.loginLogTableTitle') }}
    </template>
    <template #toolbarButton>
      <a-input-search
        style="width: 400px"
        :placeholder="t('org.login-log.loginLogTableSerachPlh')"
        v-model:value="queryParam.likeAll"
        @search="onTableSearch"
      ></a-input-search>
      <!-- <qc-add-button @click="addButtonClick"></qc-add-button>
      <qc-delete-button @click="deleteButtonClick"></qc-delete-button> -->
    </template>
    <!-- <template #customLoginUserName="{ text, record }">
      <qc-link :url="loginLogEditUrl + record[primaryKey]">
        {{ text }}
      </qc-link>
    </template> -->
  </qc-page-table>
</template>
<script lang='ts'>
import { defineComponent, onMounted, reactive, ref, toRefs } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import loginLogApi from '/@/api/org/login-log'
import { loginLogTableColumns, loginLogQueryColumns, loginLogAddPageUrl, loginLogEditUrl } from '../interface'
import { useModelPageTable } from '/@/kit/model-kit'
export default defineComponent({
  name: 'LoginLogList',
  setup(props) {
    const { t } = useI18n()
    const router = useRouter()
    const loginLogPageTableRef = ref()
    const queryParam = { likeAll: null }
    const { primaryKey, searchTable, reloadTable, loadData, deleteSelectData } = useModelPageTable(
      loginLogPageTableRef,
      loginLogApi,
      queryParam
    )
    const loginLogState = reactive({
      loginLogEditUrl,
      columns: loginLogTableColumns,
      primaryKey,
      queryParam,
      loadData,
      addButtonClick: () => router.push({ path: loginLogAddPageUrl }),
      deleteButtonClick: () => deleteSelectData(),
      onTableSearch: () => reloadTable(),
    })
    onMounted(() => searchTable())
    return {
      t,
      ...toRefs(loginLogState),
      loginLogPageTableRef,
      searchTable,
    }
  },
})
</script>